package com.xucy.springboot.common.MustPrettyTree;

/**
 * @Author xucy
 * @Date 2019-04-17 17:23
 * @Description 赫夫曼树编码节点
 **/

public class YsNode  implements Comparable<YsNode>{

    Byte data;
    int weight;
    YsNode leftNode;
    YsNode rightNode;

    public YsNode(Byte data,int weight){
      this.data=data;
      this.weight=weight;
    }

    @Override
    public int compareTo(YsNode o) {
        return o.weight-this.weight;
    }

    @Override
    public String toString() {
        return "YsNode{" +
                "data=" + data +
                ", weight=" + weight +
                '}';
    }
}
